home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / PowerPlant / AGA Classes 1.2 / Buttons / LAGAPushButton.h < prev    next >
Encoding:
Text File  |  1996-06-30  |  5.4 KB  |  130 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    LAGAPushButton.h
  3. // ===========================================================================
  4. //    “Apple Grayscale Appearance” compliant (almost) Push Button
  5. //    Copyright © 1996 Chrisoft (Christophe ANDRES)  All rights reserved.
  6. //
  7. //    You may use this source code in any application (commercial, shareware, freeware,
  8. //    postcardware, etc), but not remove this notice (no need to acknowledge the use of
  9. //    this class in the about box)
  10. //    You may not sell this source code in any form. This source code may be placed on 
  11. //    publicly accessable archive sites and source code disks. It may not be placed on 
  12. //    profit archive sites and source code disks without the permission of the author, 
  13. //    Christophe ANDRES.
  14. //    
  15. //        This source code is distributed in the hope that it will be useful,
  16. //        but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. //        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  18. //
  19. //    If you make any change or improvement on this class, please send the improved/changed
  20. //    version to : chrisoft@calva.net or Christophe ANDRES
  21. //                                     20, rue Prosper Mérimée
  22. //                                     67100 STRASBOURG
  23. //                                     FRANCE
  24. //
  25. // ===========================================================================
  26. //    LAGAPushButton.cp            <- double-click + Command-D to see class implementation
  27. //
  28. //    LAGAPushButton is my implementation of the “Apple Grayscale Appearance for System 7.5”
  29. //        Push Buttons with the exception of the pressed state. The pressed state is my own kind,
  30. //        because I (and my customers) found it nicer than Apple's ;-)
  31. //
  32. //        if mRadioBehavior is set, the Push Button acts as a RadioButton and can be used with
  33. //        a radio group
  34. //
  35. //        This class requires AGAColors.cp to be present in your project
  36. //
  37. //        Version : 1.2
  38. //
  39. //        Change History (most recent first, date in US form : mm/dd/yy):
  40. //
  41. //                        06/30/96    ca        Public release of version 1.2
  42. //                        06/04/96    ca        Added static RegisterClass for easier class registration
  43. //                                                        Added guard macros in header files
  44. //                                                        made changes to allow the usage of either the standard button template or the custom LAGAPushButton
  45. //                                                            template. The standard button template is easier for layout because you can see the text, but you
  46. //                                                            can't control the checkbox behavior of the button, which is possible from the custom template
  47. //                                                        Defined class_ID1 and CreateAGAPushButtonStream1 to handle the two template possibilities
  48. //                                                        Added a CPPb to "LAGAPushButton CPPb.rsrc" called LAGAPushButton1 to handle the standard button
  49. //                                                            template, without having to tinker the class ID
  50. //                                                        Increased version to 1.2
  51. //                        05/15/96    ca        Increased version to 1.1
  52. //                                                        Replaced mTextTraitsH by mTextTraitsID, to simplify, text traits management
  53. //                                                        Inlined and adapted SetTextTraitsID and GetTextTraitsID
  54. //                                                        Added copy constructor
  55. //                                                        Added "on the fly" constructor
  56. //                                                        Added change history
  57. //                        04/??/96    jhs        Improvements sent by James H. Stein <steinj@best.com>
  58. //                                                        Added SetTextTraitsID and GetTextTraitsID
  59. //                                                        Added missing includes (for those who do not use the "classic" PP prefix)
  60. //                        04/22/96    ca        class made available by Christophe ANDRES <chrisoft@calva.net>
  61. //                                                        (version 1.0)
  62. //
  63. //        To Do:
  64. //
  65.  
  66. #ifndef _H_LAGAPushButton
  67. #define _H_LAGAPushButton
  68. #pragma once
  69.  
  70. #include <LControl.h>
  71. #include <LString.h>
  72.  
  73. class    LAGAPushButton : public LControl
  74. {
  75.     public        :
  76.         enum { class_ID = 'AGA7', class_ID1 = 'AgA7' };
  77.         static void RegisterClass ();                                                                                                                                        //    <06/04/96    ca>
  78.         static LAGAPushButton* CreateAGAPushButtonStream (LStream *inStream);
  79.         static LAGAPushButton* CreateAGAPushButtonStream1 (LStream *inStream);                                                    //    <06/04/96    ca>
  80.     
  81.         LAGAPushButton ();
  82.                 
  83.         LAGAPushButton (LStream *inStream, Boolean inCreateWithStandardButton = false);                                    //    <06/04/96    ca>
  84.         
  85.         LAGAPushButton (const LAGAPushButton &inOriginal);                                                                                            //    <05/13/96 ca>
  86.         
  87.         LAGAPushButton (const SPaneInfo &inPaneInfo, MessageT inClickedMessage, ResIDT inTextTraitsID,    //    <05/13/96 ca>
  88.                                         Str255 inTitle, Boolean inRadioButtonBehavior);
  89.  
  90.         virtual void SetValue (Int32 inValue);
  91.         
  92.         virtual StringPtr GetDescriptor (Str255 outDescriptor) const;
  93.         
  94.         virtual void SetDescriptor (ConstStringPtr inDescriptor);
  95.         
  96.             //    <04/??/96    jhs>    <05/15/96    ca>
  97.         virtual void SetTextTraitsID (ResIDT inTextTraitsID) { mTextTraitsID = inTextTraitsID; mStyleCache = -1; };
  98.  
  99.             //    <04/??/96    jhs>    <05/15/96    ca>
  100.         virtual ResIDT GetTextTraitsID () { return(mTextTraitsID); };
  101.                                     
  102.     protected    :
  103.         virtual void HotSpotResult (Int16 inHotSpot);
  104.         
  105.         virtual void HotSpotAction (Int16 inHotSpot, Boolean inCurrInside, Boolean inPrevInside);
  106.  
  107.         virtual void DrawSelf ();    
  108.         
  109.         virtual void DrawAll (Boolean inPushed);
  110.         
  111.         virtual void DrawGraphic (Boolean inPushed);
  112.         
  113.         virtual void DrawText (Boolean inPushed);
  114.  
  115.         virtual void DisableSelf () { Refresh(); };
  116.  
  117.         virtual void EnableSelf () { Refresh(); };
  118.  
  119.         LStr255 mTitle;    
  120.         ResIDT mTextTraitsID;                                                                                                                                                    //    <05/15/96    ca>
  121.         Int16 mStyleCache;                //    <05/15/96    ca>    Here, we cache the style information needed for italic adjustment
  122.  
  123.         Boolean mRadioBehavior;
  124.         
  125.     private:
  126.         static char mCorners[3][4][4][4];
  127. };
  128.  
  129. #endif
  130.